package com.strategy.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.strategy.demo.enums.NoticeTypeEnum;
import com.strategy.demo.factory.NoticeStrategyFactory;

@RestController
@RequestMapping("/strategy")
public class StrategyTestController {

	@Autowired
	private NoticeStrategyFactory noticeStrateyFactory;
	
	@GetMapping("sendSysNotice")
	public void sendSysNotice() {
		noticeStrateyFactory.getHandler(NoticeTypeEnum.SYSTEM).doStrategy("有一条系统消息！！");
	}

	@GetMapping("sendLikeNotice")
	public void sendLikeNotice() {
		noticeStrateyFactory.getHandler(NoticeTypeEnum.LIKE).doStrategy("xxx给你点赞了！！");
	}

	@GetMapping("sendCommentNotice")
	public void sendCommentNotice() {
		noticeStrateyFactory.getHandler(NoticeTypeEnum.COMMENT).doStrategy("xxx评论了你的博客！！");
	}
}
